// vite.config.js
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
// import { visualizer } from "rollup-plugin-visualizer";

export default defineConfig({
  plugins: [
    AutoImport({
      include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/],
      imports: [
        "vue",
        "uni-app",
        {
          "@/commons/api": [["default", "_api"]],
          "@/store/temporary": ["useTemporaryStore"],
        },
      ],
      dts: "typings/auto-imports.d.ts",
    }),
    Components({
      dirs: ["components"],
      dts: "components.d.ts",
    }),
    // visualizer(),
    uni(),
  ],
  css: {
    preprocessorOptions: {
      scss: {
        // 取消sass废弃API的报警
        silenceDeprecations: ["legacy-js-api", "color-functions", "import"],
      },
    },
  },
});
